<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js"></script>
    <title>Document</title>
</head>
<body>
<div class="main">
    <h2>A公司网站</h2>
    <div class="nav" style="background: #333;height: 60px;padding: 5px;">
        <p style="color: #ffffff; float: right" class="login">登录</p>
        <p hidden=""style="color: #ffffff;  float: right" id="welcome"></p>
    </div>
</div>
</body>
</html>

<?php
session_start();
if (!empty($_SESSION['user_info'])) {
    $user_info = $_SESSION['user_info'];
    ?>
    <script>
        $(function () {
            $(".login").remove();
            $("#welcome").text("欢迎登录:" + "<?php echo $user_info['username']; ?>").show();;
        })
    </script>
    <?php
} else {
    ?>
    <script src="./check_login.php" class="check_login"></script>
    <?php
}
?>

<script>
    $(".login").click(function () {
        window.location='http://ucenter.xhyonline.com?server=www.a.com';
    })
</script>



